//属性管理相关的接口
import request from "@/utils/request";
import type { CategoryResponseData ,AttrResponseData} from "./type";
enum API {
  //一级分类
  C1_URL = "/admin/product/getCategory1",
  //二级分类
  C2_URL = "/admin/product/getCategory2/",
  //三级分类
  C3_URL = "/admin/product/getCategory3/",
  // 获取分类下已有的属性与属性值
  ATTR_URL = "/admin/product/attrInfoList/",
}
//一级分类
export const reqC1 = () => request.get<any, any>(API.C1_URL);
//二级分类
export const reqC2 = (category1Id: number | string) =>
  request.get<any, CategoryResponseData>(API.C2_URL + category1Id);
//三级分类
export const reqC3 = (category2Id: number | string) =>
  request.get<any, CategoryResponseData>(API.C3_URL + category2Id);
// 获取分类下已有的属性与属性值
export const reqAttr = (
  category1Id: number | string,
  category2Id: number | string,
  category3Id: number | string
) =>
  request.get<any, AttrResponseData>(
    API.ATTR_URL + `${category1Id}/${category2Id}/${category3Id}`
  );
